
type wx = {
  login: (Option) => Promise<{
    code: string;
  }>;
};



export const wechatLogin = (): Promise<Record<string, any>> => {
  return new Promise((resolve, reject) => {
    (wx as unknown as wx).login({
      success: (res) => {
        resolve(res);
      },
      fail: (res) => {
        reject(res);
      },
    });
  });
};

// 用户授权获取wifi信息wx.getSetting
export const wechatGetSetting = (): Promise<Record<string, any>> => {
  return new Promise((resolve, reject) => {
    (wx as unknown as wx).getSetting({
      success: (res) => {
        resolve(res);
      },
      fail: (res) => {
        reject(res);
      },
    });
  });
}
// 用户授权获取wifi信息wx.authorize
export const wechatAuthorize = (): Promise<Record<string, any>> => {
  return new Promise((resolve, reject) => {
    (wx as unknown as wx).authorize({
      scope: 'scope.wifi',
      success: (res) => {
        resolve(res);
      },
      fail: (res) => {
        reject(res);
      },
    });
  });
}